package com.zh.creature;

import com.zh.Scene;
import com.zh.Ui;
import com.zh.article.Weapon;
import com.zh.room.Room;

/**
 * @description:
 * @author: zhangHang
 * @date: Created in 2020/4/27 10:17
 * @version: 1.0
 * @modified By:
 */
public class Person extends Creature {

    @Override
    public void useWeapon(Weapon weapon, Creature targetCreature, Scene scene) {
        weapon.useWeapon(targetCreature,scene);
    }

    @Override
    public void pickWeapon(String id) {
        this.getWeaponSet().getWeapons().add(this.getCurrentRoom().getWeaponSet().get(id));
    }

    @Override
    public void changeWeapon(String id) {
        this.setCurrentWeapon(this.getWeaponSet().get(id));
    }

    @Override
    public void pickDrug(String id) {
        this.getDrugSet().getDrugs().add(this.getCurrentRoom().getDrugSet().get(id));
    }

    @Override
    public void useDrug(String id) {
        this.getDrugSet().get(id).useDrug(this);
    }

    public void go(String targetRoomId){
        Room room;
        room=this.getCurrentRoom().goReachableRoomById(targetRoomId,this.getCurrentRoom().getReachableRooms());
        if(room!=null){
           this.setCurrentRoom(room);

        }
        else {
            if(this.getId()=="protagonist"){
                Ui.printNoRoom();//保证只输出一次没有房间的信息，帮手哪里就不用了
            }

        }

    }
}
